1. Field of the Invention
The present invention relates to an intermediate code preprocessing apparatus which applies preprocessing to an intermediate code in order to improve execution speed of the intermediate code by, e.g., a virtual machine, an intermediate code execution apparatus which executes the intermediate code subjected to the preprocessing, an intermediate code execution system, and a computer program product used to apply the preprocessing to the intermediate code or execute the intermediate code.
2. Description of the Related Art
For the purpose of providing a program which does not depend on the platform of a computer such as hardware or OS, there has been proposed a method of constructing a virtual machine (VM) on each platform by software techniques or hardware techniques and executing an intermediate code between source code and object code on the virtual machine. As one of the program languages adopting such a method, there is Java™, which adopts a form of intermediate code called a class file. It is to be noted that the hardware and the virtual machine constructed on the hardware may be collectively referred to as an intermediate code execution system hereinafter.
According to the above-described method, since single program code can be supplied to various platforms and executed, it is no longer necessary to prepare object code which can be executed only on each platform. As a result, not only distribution of the program can be simplified, but software development can be made efficient. Therefore, virtual machines have been built on various computer platforms. Further, in recent years, construction of virtual machines on processors has also been started in various electronic devices (which will be referred to as an embedded device hereinafter) having a processor mounted therein.
Here, as the virtual machine, there is known one which is of an interpreter type which is provided on the platform in the form of software and sequentially interprets and executes bytecode instructions included in a class file. The interpreter type virtual machine requires a process of taking out bytecode instructions one by one from the class file and interpreting their contents. This process becomes the overhead in the prior art, and the excellent performance cannot be obtained.
Thus, there has been proposed a JIT compiler (Just In Time Compiler) system, an AOT compiler (Ahead Of Time Compiler) or the like which compiles the class file into native code inherent to each type of hardware and then executes it for the purpose of improving performance. Furthermore, there has been attempted construction of a virtual machine in the form of hardware like a Java™ chip which is specially designed to enable direct execution of bytecode instructions.
In the compiler system such as JIT or AOT mentioned above, since the native code of the processor is executed, it is superior to the interpreter system when taking notice only of speed of instruction execution. The compiler system, however, requires a work area for the compile operation itself or an area for storing the native code, which is four to ten times the size of the class file, and hence a larger quantity of memory is disadvantageously required than in the interpreter system. Such a problem is prominent in an embedded device in which restriction in hardware resources is greater than that in a regular computer in particular. Moreover, when starting compile after directing execution of the class file, the compilation operation becomes the overhead, and sufficient performance may not be obtained.
In addition, according to the Java™ chip mentioned above, although the class file can be executed with high performance without performing compilation, a large development cost is required in development of such a dedicated chip, and an increase in the cost of the chip itself is inescapable. Additionally, in view of the fact that version upgrade or bug fixing is appropriately performed in the language specification according to advancement in technology or needs in the market, there is an aspect that constructing the virtual machine in the form of hardware is not necessarily preferable. In particular, in the virtual machine in the embedded device, adoption of a Java™ chip is not realistic because of the combination of strong demands for reduction in cost and version updating of the specification in a short cycle.
As described above, it is hard to apply the virtual machine such as the compiler system or the Java™ chip in an embedded device or the like. Therefore, a technique which improves the performance during execution of the intermediate code has been demanded on the assumption of application in an embedded device.